From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj@www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj@www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx@linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj@www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj@www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj@www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj@www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj@www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj@www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj@www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj@www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj@www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry@12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry@12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry@12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry@12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces@linuxgrrls.org [mailto:rxtx-bounces@linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx@linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx@linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj@www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces@linuxgrrls.org [mailto:rxtx-bounces@linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx@linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj@www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj@www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj@www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj@www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj@www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Tue Mar 14 23:21:49 2006 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces@linuxgrrls.org [mailto:rxtx-bounces@linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj@www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx@linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj@www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj@www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx@linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0001.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj@www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj@www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj@www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj@www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj@www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj@www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj@www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0001.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj@www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj@www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry@12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry@12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry@12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry@12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces@linuxgrrls.org [mailto:rxtx-bounces@linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx@linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx@linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj@www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces@linuxgrrls.org [mailto:rxtx-bounces@linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx@linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj@www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj@www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj@www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:09 2006 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj@www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Tue Mar 28 18:25:10 2006 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0001.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:10 2006 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj@www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Tue Mar 28 18:25:10 2006 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces@linuxgrrls.org [mailto:rxtx-bounces@linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj@www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx@linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj@www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj@www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx@linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0002.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj@www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj@www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj@www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj@www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj@www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj@www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx@linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj@www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0002.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj@www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj@www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry@12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry@12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry@12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry@12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces@linuxgrrls.org [mailto:rxtx-bounces@linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx@linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx@linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj@www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces@linuxgrrls.org [mailto:rxtx-bounces@linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx@linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj@www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj@www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj@www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj@www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0002.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj@www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Tue Mar 28 20:17:09 2006 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces@linuxgrrls.org [mailto:rxtx-bounces@linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj@www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx@linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0003.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0003.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0003.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0004.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0004.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0004.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0005.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0005.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0005.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0006.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0006.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0006.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0007.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0007.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0007.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0008.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0008.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0008.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0009.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0009.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0009.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0010.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0010.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0010.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0011.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0011.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0011.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0012.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0012.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0012.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0013.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0013.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0013.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0014.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0014.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0014.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0015.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0015.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0015.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0016.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0016.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0016.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0017.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0017.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0017.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0018.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0018.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0018.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0019.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0019.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0019.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0020.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0020.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0020.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0021.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0021.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0021.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0022.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0022.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0022.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0023.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0023.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0023.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0024.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0024.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0024.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0025.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0025.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0025.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0026.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0026.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0026.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0027.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0027.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0027.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0028.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0028.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0028.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0029.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0029.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0029.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0030.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0030.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0030.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0031.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0031.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0031.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0032.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0032.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0032.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0033.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0033.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0033.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0034.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0034.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0034.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0035.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0035.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0035.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0036.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0036.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0036.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0037.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0037.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0037.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0038.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0038.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0038.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0039.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0039.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0039.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0040.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0040.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0040.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0041.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0041.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0041.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0042.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0042.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0042.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0043.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0043.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0043.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0044.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0044.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0044.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0045.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0045.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0045.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0046.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0046.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0046.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0047.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0047.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0047.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0048.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0048.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0048.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0049.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0049.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0049.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0050.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0050.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0050.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0051.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0051.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0051.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0052.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0052.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0052.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0053.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0053.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0053.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0054.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0054.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0054.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0055.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0055.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0055.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0056.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0056.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0056.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0057.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0057.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0057.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0058.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0058.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0058.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0059.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0059.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0059.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0060.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0060.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0060.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0061.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0061.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0061.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0062.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0062.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0062.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0063.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0063.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0063.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0064.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0064.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0064.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0065.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0065.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0065.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0066.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0066.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0066.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0067.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0067.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0067.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0068.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0068.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0068.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0069.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0069.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0069.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0070.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0070.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0070.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0071.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0071.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0071.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0072.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0072.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0072.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0073.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0073.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0073.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0074.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0074.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0074.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0075.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0075.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0075.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0076.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0076.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0076.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0077.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0077.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0077.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0078.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0078.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0078.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0079.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0079.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0079.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0080.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0080.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0080.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0081.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0081.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0081.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0082.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0082.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0082.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0083.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0083.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0083.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0084.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0084.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0084.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0085.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0085.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0085.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0086.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0086.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0086.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0087.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0087.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0087.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0088.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0088.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0088.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0089.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0089.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0089.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0090.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0090.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0090.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0091.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0091.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0091.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0092.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0092.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0092.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0093.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0093.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0093.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0094.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0094.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0094.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0095.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0095.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0095.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0096.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0096.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0096.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0097.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0097.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0097.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0098.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0098.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0098.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0099.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0099.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0099.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0100.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0100.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0100.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0101.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0101.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0101.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0102.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0102.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0102.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0103.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0103.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0103.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0104.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0104.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0104.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0105.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0105.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0105.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0106.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0106.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0106.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0107.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0107.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0107.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0108.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0108.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0108.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0109.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0109.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0109.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0110.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0110.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0110.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0111.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0111.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0111.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0112.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0112.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0112.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0113.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0113.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0113.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0114.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0114.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0114.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0115.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0115.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0115.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0116.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0116.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0116.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0117.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0117.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0117.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0118.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0118.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0118.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0119.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0119.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0119.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0120.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0120.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0120.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0121.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0121.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0121.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0122.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0122.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0122.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0123.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0123.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0123.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0124.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0124.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0124.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0125.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0125.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0125.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0126.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0126.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0126.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0127.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0127.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0127.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0128.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0128.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0128.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0129.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0129.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max From ricardo.trindade at emation.pt Tue Mar 2 08:34:35 2004 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 2 Mar 2004 15:34:35 -0000 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044A30A.1050901@vodafone.it> Message-ID: do yourself a favor and buy a hardware converter. there are several posts in this list regarding your issue. if you don't know where to look, you can start here : www.rs485.com www.bb-europe.com ricardo -----Mensagem original----- De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em nome de Massimiliano Calipari Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 Para: rxtx at linuxgrrls.org Assunto: [Rxtx] Driving rs232-rs485 converter Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data from the converter. (Sending is ok). Here is a bit of code i've unsuccessfully tried : serial.setDTR(true); serial.setRTS(true); //Thread.sleep(500); //same results with or without serialOut.write(packet); serialOut.flush(); //Thread.sleep(500); serial.setRTS(false); //Thread.sleep(waitTime); ..... data reading code Thanx, Max _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From maxcalipari at vodafone.it Tue Mar 2 11:45:26 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 19:45:26 +0100 Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044B076.3050308@vodafone.it> References: <20040302153259.99372.qmail@web13206.mail.yahoo.com> <4044B076.3050308@vodafone.it> Message-ID: <4044D646.6010106@vodafone.it> Sorry Trent, can you send me how to buld xxRS485.dll. I'm looking into he code to resolve dependancies but it's a little bit time consuming for me and i've very poor time before the deadline of my thesis... Thanx a lot From taj at www.linux.org.uk Tue Mar 2 12:06:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 19:06:05 +0000 (GMT) Subject: [Rxtx] Driving rs232-rs485 converter In-Reply-To: <4044D646.6010106@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Sorry Trent, > can you send me how to buld xxRS485.dll. > I'm looking into he code to resolve dependancies but it's a little bit > time consuming for me > and i've very poor time before the deadline of my thesis... RS485Imp.c will not currently build for w32. It could be possible to get it working by using the termios support SerialImp.c does. This is a _very_ problematic area to be trying. The hardware converters are inexpensive and will save you many days of hassle. You should be able to use an inexpensive hardware converter as pointed out earlier with the RS232 support rxtx offers. Kernel developers will not claim their drivers will work reliably with RS485 hacks. People have done things like this in earlier versions of Linux and probably with realtime patches for Linux. These early hacks are why I originally put the code into rxtx. Since then I've had email conversations with kernel developers and have been convinced that trying to do it is a bad idea unless you want to tinker with kernels. We really are trying to save you an unreasonable amount of trouble by recommending the hardware converters. If you are convinced you want to try this in software, I would probably just put the code flip the control lines right into SerialImp.c. That already uses termios.c. You do not want to manipulate the control lines from Java as there would be far to much delay. You would want to do it right in the native code. But be warned, the timing can cause you to pull out hair. I would at lease discuss the previous two replies you got from the mail-list with your advisor before moving forward with a software solution for a problem best solved with inexpensive hardware. -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Wed Mar 3 00:27:33 2004 From: achu at cypressasia.com (Adrian Chu) Date: Wed, 3 Mar 2004 15:27:33 +0800 Subject: [Rxtx] Driving rs232-rs485 converter References: Message-ID: <000f01c400f1$01b03520$0d01a8c0@adrian> Massimiliano, are you an italian? from my experience, you ought to find the auto-RTS RS-485 converter instead of changing RTS by yourself, coz i faced 100% communication lost if i change it by myself. You can find the auto-RTS RS-485 converter in http://www.jara.com.cn (model no: 2012E, around US 10) There is also an converter made in UK but it is VERY expensive, around US100 Best Regards, Adrian ----- Original Message ----- From: "Ricardo Trindade" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 11:34 PM Subject: RE: [Rxtx] Driving rs232-rs485 converter > do yourself a favor and buy a hardware converter. there are several posts in > this list regarding your issue. > > if you don't know where to look, you can start here : > > www.rs485.com > www.bb-europe.com > > ricardo > > > -----Mensagem original----- > De: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]Em > nome de Massimiliano Calipari > Enviada: ter?a-feira, 2 de Mar?o de 2004 15:07 > Para: rxtx at linuxgrrls.org > Assunto: [Rxtx] Driving rs232-rs485 converter > > > Does anyone know how to drive a rs-232/rs-485 converter from java? > What are the excat steps to do? > I know that there is a trick with RTS signal, i've tried various > solution (even with java CommAPI) but > i can't read data from the converter. (Sending is ok). > > Here is a bit of code i've unsuccessfully tried : > serial.setDTR(true); > serial.setRTS(true); > //Thread.sleep(500); //same results with or without > serialOut.write(packet); > serialOut.flush(); > //Thread.sleep(500); > serial.setRTS(false); > //Thread.sleep(waitTime); > ..... data reading code > Thanx, Max > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From oyvind.harboe at zylin.com Wed Mar 3 04:36:13 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Wed, 03 Mar 2004 12:36:13 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() Message-ID: <1078313772.8051.18.camel@famine> An app that I'm using relies on javax.comm from Sun. When I switch to rxtx.org's implementation, it stopped working and apparently Thread.interrupt() will not abort a SerialInputStream.read() call. Checking the stack-frame, I see that the thread is stuck in the method below: protected native int readArray( byte b[], int off, int len ) throws IOException; Is this correct? This is not a complaint, a bug report or an implicit suggestion as to how things ought or ought not to be. It is just a question to verify that I have interpreted the situation correctly. ?yvind From taj at www.linux.org.uk Wed Mar 3 12:35:13 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 3 Mar 2004 19:35:13 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078313772.8051.18.camel@famine> Message-ID: On Wed, 3 Mar 2004, ?yvind Harboe wrote: > An app that I'm using relies on javax.comm from Sun. When I switch to > rxtx.org's implementation, it stopped working and apparently > Thread.interrupt() will not abort a SerialInputStream.read() call. > > Checking the stack-frame, I see that the thread is stuck in the method > below: > > protected native int readArray( byte b[], int off, int len ) > throws IOException; > > > Is this correct? > > > This is not a complaint, a bug report or an implicit suggestion as to > how things ought or ought not to be. It is just a question to verify > that I have interpreted the situation correctly. > > ?yvind > > By default, rxtx reads do not have a timeout or threshold set. The default was not documented. With rxtx's current defaults, read will block until it reads the data requested. Currently we do nothing with a Thread.interrupt() to stop the native read. The native code ignores most signals. I suspect your observations are correct. Ideally, rxtx should behave like Sun's CommAPI. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 01:54:12 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:54:12 +0100 Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: References: Message-ID: <1078390452.9557.53.camel@famine> Has there been any discussion of moving RXTX to GNU Classpathx? My thinking is that javax.comm could benefit from the increased exposure. GNU Classpathx then being a one-stop-shop for all your javax.* needs. :-) http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html ?yvind From oyvind.harboe at zylin.com Thu Mar 4 01:59:21 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 09:59:21 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078390761.9557.56.camel@famine> > By default, rxtx reads do not have a timeout or threshold set. The > default was not documented. With rxtx's current defaults, read will block > until it reads the data requested. > > Currently we do nothing with a Thread.interrupt() to stop the native read. > The native code ignores most signals. > > I suspect your observations are correct. Ideally, rxtx should behave like > Sun's CommAPI. Incidentally I also need to use Win32 GCJ for this thing, so Thread.interrupt() is a no go anyway. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:16:43 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:16:43 +0000 (GMT) Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: <1078390761.9557.56.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > > By default, rxtx reads do not have a timeout or threshold set. The > > default was not documented. With rxtx's current defaults, read will block > > until it reads the data requested. > > > > Currently we do nothing with a Thread.interrupt() to stop the native read. > > The native code ignores most signals. > > > > I suspect your observations are correct. Ideally, rxtx should behave like > > Sun's CommAPI. > > Incidentally I also need to use Win32 GCJ for this thing, so > Thread.interrupt() is a no go anyway. > > ?yvind Interesting. You may want to look here: ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz or untarred ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI Thats a snapshot of an earlier version of rxtx that compiles with GCJ on Linux. It should have all the code changes required for the CNI (GCJ). I just did it as a test of GCJ but it appeared to work fine in some simple tests. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Thu Mar 4 02:38:17 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Thu, 04 Mar 2004 10:38:17 +0100 Subject: [Rxtx] Thread.interrupt() on SerialInputStream.read() In-Reply-To: References: Message-ID: <1078393096.9557.60.camel@famine> > Interesting. You may want to look here: > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16.tar.gz > > or untarred > > ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre16/CNI > > Thats a snapshot of an earlier version of rxtx that compiles with GCJ on > Linux. It should have all the code changes required for the CNI (GCJ). > I just did it as a test of GCJ but it appeared to work fine in some simple > tests. GCJ now supports JNI out of the box, so I don't think CNI has any part to play here. On my very first attempt, RXTX didn't work, but I haven't looked closer yet. ?yvind From taj at www.linux.org.uk Thu Mar 4 02:41:10 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 4 Mar 2004 09:41:10 +0000 (GMT) Subject: [Rxtx] Moving RXTX to GNU Classpathx In-Reply-To: <1078390452.9557.53.camel@famine> Message-ID: On Thu, 4 Mar 2004, ?yvind Harboe wrote: > Has there been any discussion of moving RXTX to GNU Classpathx? > > My thinking is that javax.comm could benefit from the increased > exposure. GNU Classpathx then being a one-stop-shop for all your > javax.* needs. :-) > > > http://mail.gnu.org/archive/html/classpathx-discuss/2003-11/msg00017.html > > ?yvind > > We have tried combining rxtx in with kaffe in the past but some problems showed up and there was too much going on. We will try again, I'm sure. The kaffe group is great. rxtx is not part of GNU; just a friend :) The authors of GNU Classpath are free to encorperate rxtx into GNU classpath as licensed and copyrighted. There may be valid reasons GNU classpath should not encorperate rxtx; they probably want a javax.comm implementation and Sun's click through licensing for CommAPI may prevent rxtx from ever using that namespace. In practice, its a tossup between people wanting the namespace rxtx uses and Sun's Javax.comm. I'd rather let others worry about such things. -- Trent Jarvi taj at www.linux.org.uk From oyvind.harboe at zylin.com Fri Mar 5 02:06:52 2004 From: oyvind.harboe at zylin.com (=?ISO-8859-1?Q?=D8yvind?= Harboe) Date: Fri, 05 Mar 2004 10:06:52 +0100 Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables Message-ID: <1078477612.11267.23.camel@famine> I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box w/the latest release). A couple of questions: - Which CVS branch should I use? - When compiling a Win32 executeable, my plan was to cross compile from CygWin. cd builddir export CFLAGS='-mno-cygwin' /src/configure --prefix=`pwd`/install make How can I tell RXTX build to use GCJ to build .java -> .class files? gcj -C Foo.java produces Foo.class ?yvind From taj at www.linux.org.uk Fri Mar 5 04:32:47 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 5 Mar 2004 11:32:47 +0000 (GMT) Subject: [Rxtx] Getting RXTX to work w/GCJ to produce native executables In-Reply-To: <1078477612.11267.23.camel@famine> Message-ID: On Fri, 5 Mar 2004, ?yvind Harboe wrote: > I'm debugging the problems w/GCJ and RXTX(it doesn't work out of the box > w/the latest release). > > A couple of questions: > > - Which CVS branch should I use? > > - When compiling a Win32 executeable, my plan was to cross compile from > CygWin. > > cd builddir > export CFLAGS='-mno-cygwin' > /src/configure --prefix=`pwd`/install > make > > How can I tell RXTX build to use GCJ to build .java -> .class files? > > gcj -C Foo.java > > produces > > Foo.class > I have not tried the JNI features of GCJ mentioned so I can provide little info about how to setup up build scripts or Makefiles with it yet. I have only tried the CNI features and they appear to work as mentioned earlier. You may try modifying the CNI Makefile I used to build on linux as a starting point. ftp://jarvi.dsl.frii.com/pub/to_sort/CNI2/Makefile I see I used "gcj -d . -C *.java" The cross compiling features are not in there for the SerialImp.c and termios.c. Makefile.am that comes with rxtx has the bits for cross compiling. Just look at the bottom for: ################ WIN32 CrossCompiling from here down ####################### What out for hard coded $(target_alias) variables. ie: i386-mingw32. Sometimes that should be i386-pc-mingw32 with more current builds. The CVS you probably want is cvs checkout -r commapi-0-0-1 rxtx-devel Thats rxtx 2.1 with the full API. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 11:55:26 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 10:55:26 -0800 Subject: [Rxtx] Help With Lock Files Message-ID: Hi, I've installed the 2.0.5 release into my RedHat 7.3 box and am continually running into the following error: RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyS0: File exists I've been through the list archives and the various readme files with no luck. Running java 1.4.2_03 and logged on as root. Any ideas? Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040307/244cae10/attachment-0129.html From taj at www.linux.org.uk Sun Mar 7 13:16:05 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Sun, 7 Mar 2004 20:16:05 +0000 (GMT) Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk From jimo at earthlink.net Sun Mar 7 18:44:57 2004 From: jimo at earthlink.net (Jim Owen) Date: Sun, 7 Mar 2004 17:44:57 -0800 Subject: [Rxtx] Help With Lock Files In-Reply-To: Message-ID: Hi Trent, I'll give it a try and let you know how it works - I am running as root. Regards, Jim -----Original Message----- From: rxtx-bounces at linuxgrrls.org [mailto:rxtx-bounces at linuxgrrls.org]On Behalf Of Trent Jarvi Sent: Sunday, March 07, 2004 12:16 PM To: Java RXTX discussion Subject: Re: [Rxtx] Help With Lock Files On Sun, 7 Mar 2004, Jim Owen wrote: > Hi, > > I've installed the 2.0.5 release into my RedHat 7.3 box and am continually > running into the following error: RXTX fhs_lock() Error: creating lock file: > /var/lock/LCK..ttyS0: File exists > > I've been through the list archives and the various readme files with no > luck. > > Running java 1.4.2_03 and logged on as root. > > Any ideas? > > Thanks, > Make sure the user trying to run the application is in group uucp/lock as mentioned in the INSTALL file that comes with the source. When set up properly the user should be able to create and remove the lockfile. Also make sure that there is not another application running that is using the port. The pid of the application that is supsected of having the port in use is in the lockfile. finally, Lock files are removed when an application closes a port. Make sure ports are closed before quiting. If the application quits before closing the port a stale lockfile will be left. The next time you run the application the program will mention 'removing stale lockfile' if everything is setup properly. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx From minyal at nortelnetworks.com Mon Mar 1 08:52:05 2004 From: minyal at nortelnetworks.com (Minya Liang) Date: Mon, 1 Mar 2004 09:52:05 -0600 Subject: [Rxtx] about non-blicking io Message-ID: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> i think Adrian is talking about something similar to the NIO feature new in Java 1.4, stuff such as channels and selectors etc, instead of just inputstream and outputstream. LMY -----Original Message----- From: Trent Jarvi [mailto:taj at www.linux.org.uk] Sent: Saturday, February 28, 2004 10:09 AM To: Java RXTX discussion Subject: Re: [Rxtx] about non-blicking io On Sat, 28 Feb 2004, Adrian Chu wrote: > Dear Trent, > > Is there a way to use non-blocking IO with your RXTX? > > Best Regards, > Adrian Hi andrian I think you want to look at the timeout and threshold settings. They should do what you want. But maybe you are looking for something more? -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at linuxgrrls.org http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040301/6cbe9a25/attachment-0130.html From taj at www.linux.org.uk Mon Mar 1 09:50:08 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Mon, 1 Mar 2004 16:50:08 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <870397D7C140C84DB081B88396458DAF0492B458@zrc2c000.us.nortel.com> Message-ID: Hmm http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this right, its selecting on a set of file descriptors so the thread count can stay low. RXTX currently selects in an event loop for each port. nbio is not currently in rxtx. But I see Matt Welsh has released a library licensed under a BSD license which could be used to do this: http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ I'm not sure this is a problem in rxtx. Keeping thread counts low is always a good thing but I have a hard time picturing the current implementation running into bottlenecks. I'm curious if Adrian has run into a problem. On Mon, 1 Mar 2004, Minya Liang wrote: > i think Adrian is talking about something similar to the NIO feature new in > Java 1.4, stuff such as channels and selectors etc, instead of just > inputstream and outputstream. > > LMY > > -----Original Message----- > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > Sent: Saturday, February 28, 2004 10:09 AM > To: Java RXTX discussion > Subject: Re: [Rxtx] about non-blicking io > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > Dear Trent, > > > > Is there a way to use non-blocking IO with your RXTX? > > > > Best Regards, > > Adrian > > Hi andrian > > > I think you want to look at the timeout and threshold settings. They > should do what you want. > > But maybe you are looking for something more? > > -- Trent Jarvi taj at www.linux.org.uk From achu at cypressasia.com Mon Mar 1 18:53:46 2004 From: achu at cypressasia.com (Adrian Chu) Date: Tue, 2 Mar 2004 09:53:46 +0800 Subject: [Rxtx] about non-blicking io References: Message-ID: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Hi all, Thank you for your detailed reply Trent. You are always good. ^_< However it would be nice if you can tell me what a thread count is. Is it the number of current executing threads? Recently I am trying to improve the performance of my java program. I found that if I get data using event (as what written in the example SimpleRead.java of Suns), the performance will be slower by 35% than if I get data by calling inputstream.read() after outputstream.write(....). However, the latter one may be blocked if there is no data received. So I am finding a way to let it to be unblocked EVEN the serial port driver doesn't support timeout. So, anyone tries to get data other than the method used in SimpleRead.java? Please share your valuable experience. Best Regards, Adrian ----- Original Message ----- From: "Trent Jarvi" To: "Java RXTX discussion" Sent: Tuesday, March 02, 2004 12:50 AM Subject: RE: [Rxtx] about non-blicking io > > Hmm > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > right, its selecting on a set of file descriptors so the thread count can > stay low. RXTX currently selects in an event loop for each port. > > nbio is not currently in rxtx. But I see Matt Welsh has released > a library licensed under a BSD license which could be used to do this: > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > always a good thing but I have a hard time picturing the current > implementation running into bottlenecks. I'm curious if Adrian has run > into a problem. > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > i think Adrian is talking about something similar to the NIO feature new in > > Java 1.4, stuff such as channels and selectors etc, instead of just > > inputstream and outputstream. > > > > LMY > > > > -----Original Message----- > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > Sent: Saturday, February 28, 2004 10:09 AM > > To: Java RXTX discussion > > Subject: Re: [Rxtx] about non-blicking io > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > Dear Trent, > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > Best Regards, > > > Adrian > > > > Hi andrian > > > > > > I think you want to look at the timeout and threshold settings. They > > should do what you want. > > > > But maybe you are looking for something more? > > > > > > -- > Trent Jarvi > taj at www.linux.org.uk > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > From taj at www.linux.org.uk Mon Mar 1 20:54:56 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 03:54:56 +0000 (GMT) Subject: [Rxtx] about non-blicking io In-Reply-To: <000d01c3fff9$35de0c30$0d01a8c0@adrian> Message-ID: On Tue, 2 Mar 2004, Adrian Chu wrote: > Hi all, > > Thank you for your detailed reply Trent. You are always good. ^_< > > However it would be nice if you can tell me what a thread count is. Is it > the number of current executing threads? Yes. Thats what I was thinking of. I think I see what you are looking at below. > > Recently I am trying to improve the performance of my java program. I found > that if I get data using event (as what written in the example > SimpleRead.java of Suns), the performance will be slower by 35% than if I > get data by calling inputstream.read() after outputstream.write(....). > However, the latter one may be blocked if there is no data received. So I am > finding a way to let it to be unblocked EVEN the serial port driver doesn't > support timeout. > > So, anyone tries to get data other than the method used in SimpleRead.java? > Please share your valuable experience. This is an area where a little bit of tuning can go a long ways. There are a few things to think about. First the penalty of calling acrossed the JNI is expensive from what I saw. So one of the worst things you could do is read one byte at a time on each data available event rather than read the number of bytes available. Another thing to think about is select() in the eventLoop()/SerialImp.c will not block while data is available. So the eventLoop either spins or you can force it to sleep(). To keep the eventLoop from spinning, rxtx sleeps in the eventLoop after sending data available. Maybe this sleep() is the performance difference you see. This is something that can be tuned more to your liking. Using a scope (I wasnt sure about the calibration) it looked like you can tune these so that a loopback device sending a byte, getting data available and reading the byte can happen in about 10 ms with Linux and 8 ms with w32. I had tried to make the sleeps so that CPU use was not noticable while data was available. One last though, rxtx does not buffer. The underlying drivers may buffer, but rxtx reads and writes when asked. For the sleep(), look for void report_serial_events( struct event_info_struct *eis ) in SerialImp.c. Thats called from the eventLoop. There is a usleep(20000) there; 20 ms. Obviously it can be less. > > Best Regards, > Adrian > > ----- Original Message ----- > From: "Trent Jarvi" > To: "Java RXTX discussion" > Sent: Tuesday, March 02, 2004 12:50 AM > Subject: RE: [Rxtx] about non-blicking io > > > > > > Hmm > > > > http://java.sun.com/j2se/1.4.2/docs/guide/nio/index.html If I read this > > right, its selecting on a set of file descriptors so the thread count can > > stay low. RXTX currently selects in an event loop for each port. > > > > nbio is not currently in rxtx. But I see Matt Welsh has released > > a library licensed under a BSD license which could be used to do this: > > > > http://www.eecs.harvard.edu/~mdw/proj/java-nbio/ > > > > I'm not sure this is a problem in rxtx. Keeping thread counts low is > > always a good thing but I have a hard time picturing the current > > implementation running into bottlenecks. I'm curious if Adrian has run > > into a problem. > > > > On Mon, 1 Mar 2004, Minya Liang wrote: > > > > > i think Adrian is talking about something similar to the NIO feature new > in > > > Java 1.4, stuff such as channels and selectors etc, instead of just > > > inputstream and outputstream. > > > > > > LMY > > > > > > -----Original Message----- > > > From: Trent Jarvi [mailto:taj at www.linux.org.uk] > > > Sent: Saturday, February 28, 2004 10:09 AM > > > To: Java RXTX discussion > > > Subject: Re: [Rxtx] about non-blicking io > > > > > > > > > On Sat, 28 Feb 2004, Adrian Chu wrote: > > > > > > > Dear Trent, > > > > > > > > Is there a way to use non-blocking IO with your RXTX? > > > > > > > > Best Regards, > > > > Adrian > > > > > > Hi andrian > > > > > > > > > I think you want to look at the timeout and threshold settings. They > > > should do what you want. > > > > > > But maybe you are looking for something more? > > > > > > > > > > -- > > Trent Jarvi > > taj at www.linux.org.uk > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at linuxgrrls.org > > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org:8080/mailman/listinfo/rxtx > -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Mon Mar 1 17:12:38 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 01:12:38 +0100 Subject: [Rxtx] Please help Message-ID: <4043D176.5050003@vodafone.it> Hi, i'm developing my thesis work and i'm going crazy with rxtx! I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all sun's commapi reference in my classpath but there is something stiil wrong... When i run my work i catch thath exception: | java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while loading gnu.io.RXTXCommDriver I've tried to change the ClassLoading that way: System.setSecurityManager(null); String driverName = "gnu.io.RXTXCommDriver"; try { CommDriver commDriver = (CommDriver) Class.forName(driverName).newInstance(); commDriver.initialize(); } catch (Exception e) { e.printStackTrace(); } and now the exception is: java.lang.UnsatisfiedLinkError: nativeGetVersion at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) What's wrong? Please help me! Thanx, Max | -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20040302/2a441714/attachment-0130.html From taj at www.linux.org.uk Tue Mar 2 01:06:01 2004 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 2 Mar 2004 08:06:01 +0000 (GMT) Subject: [Rxtx] Please help In-Reply-To: <4043D176.5050003@vodafone.it> Message-ID: On Tue, 2 Mar 2004, Massimiliano Calipari wrote: > Hi, > i'm developing my thesis work and i'm going crazy with rxtx! > I've downloaded rxtx.2.1.6, i build it with MingW, i've deleted all > sun's commapi reference in my classpath but there is something stiil > wrong... > > When i run my work i catch thath exception: > | > java.lang.UnsatisfiedLinkError: nativeGetVersion thrown while > loading gnu.io.RXTXCommDriver > > I've tried to change the ClassLoading that way: > > System.setSecurityManager(null); > String driverName = "gnu.io.RXTXCommDriver"; > try { > CommDriver commDriver = (CommDriver) > Class.forName(driverName).newInstance(); > commDriver.initialize(); > } catch (Exception e) { > e.printStackTrace(); > } > > and now the exception is: > > java.lang.UnsatisfiedLinkError: nativeGetVersion > at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) > at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) > > What's wrong? > > Please help me! > Thanx, Max > | > I ran into this last week. The line in the makefile that is generating the exports looking into the wrong directory. If you look at the i386-*-mingw32 directory created during the build and correct the line in the makefile creating the def to match, the exports will then be fixed during the build. I can show you the exact line if you let us know which Makefile you are building with. There appear to be two different ways the directories lay out: i386-mingw32 and i386-pc-mingw32 The line should be close to: echo EXPORTS >$(DEST)/Serial.def;for i in `nm i386-mingw32/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def A more correct solution would be: ----------------------------------------------vvvvvvv echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def w32 compiles are not the easiest thing to get working. There is also a compiled version on ftp://jarvi.dsl.frii.com/pub/rxtx/rxtx-2.1-7pre17-i386-pc-mingw32.tgz Sadly, that machine is going through hd replacement. I can mail the file off the list in the meantime if you like. -- Trent Jarvi taj at www.linux.org.uk From maxcalipari at vodafone.it Tue Mar 2 02:33:25 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:33:25 +0100 Subject: [Rxtx] Please help Message-ID: <404454E5.40100@vodafone.it> Thankx Trent, i've found the problem but isn't at the line mentioned above because in my makefile it's commented. The problem was in the quoted CLASSPATH: wrong: CLASSPATH=-classpath ".;" correct line CLASSPATH=-classpath .; I post my makefile at the end of message, i think it works well for win32 buid. Now i've another problem but i've looked in the mailing-list and i think i'ts jre1.4.2 dependant. I've to build another release or is better tring another jdk? Thanx, Max Error message follows: -------------------------------------------------------------------- Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x80D7235 Function=JVM_RegisterUnsafeMethods+0x188 Library=C:\j2sdk1.4.2\jre\bin\client\jvm.dll Current Java thread: at gnu.io.RXTXCommDriver.nativeGetVersion(Native Method) at gnu.io.RXTXCommDriver.(RXTXCommDriver.java:56) at it.unical.deis.lis.MADAMS.testing.Tester.main(Tester.java:41) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F40000 - 0x77FED000 C:\WINDOWS\System32\ntdll.dll 0x77E40000 - 0x77F31000 C:\WINDOWS\system32\kernel32.dll 0x77DA0000 - 0x77E3D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll 0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll 0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B00000 - 0x76B2D000 C:\WINDOWS\System32\WINMM.dll 0x5D190000 - 0x5D197000 C:\WINDOWS\System32\serwvdrv.dll 0x5B4B0000 - 0x5B4B7000 C:\WINDOWS\System32\umdmxfrm.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00820000 - 0x0082E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00830000 - 0x00848000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00850000 - 0x0085D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x02B40000 - 0x02B5C000 C:\j2sdk1.4.2\jre\bin\jdwp.dll 0x06B60000 - 0x06B65000 C:\j2sdk1.4.2\jre\bin\dt_socket.dll 0x71A30000 - 0x71A45000 C:\WINDOWS\System32\ws2_32.dll 0x71A20000 - 0x71A28000 C:\WINDOWS\System32\WS2HELP.dll 0x719D0000 - 0x71A0C000 C:\WINDOWS\System32\mswsock.dll 0x76EE0000 - 0x76F05000 C:\WINDOWS\System32\DNSAPI.dll 0x76D20000 - 0x76D37000 C:\WINDOWS\System32\iphlpapi.dll 0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll 0x76F20000 - 0x76F4D000 C:\WINDOWS\system32\WLDAP32.dll 0x76F80000 - 0x76F85000 C:\WINDOWS\System32\rasadhlp.dll 0x71A10000 - 0x71A18000 C:\WINDOWS\System32\wshtcpip.dll 0x06F50000 - 0x06F60000 D:\Workspace\MADAMS\rxtxSerial.dll 0x73D00000 - 0x73D27000 C:\WINDOWS\System32\crtdll.dll 0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll 0x6DA30000 - 0x6DAAD000 C:\WINDOWS\system32\DBGHELP.dll 0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll 0x76BB0000 - 0x76BBB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 355K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 69% used [0x10010000, 0x10068e68, 0x10090000) from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000) compacting perm gen total 4096K, used 1177K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 28% used [0x14010000, 0x14136650, 0x14136800, 0x14410000) Local Time = Tue Mar 02 10:05:45 2004 Elapsed Time = 1 # # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION # Error ID : 4F530E43505002EF # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # ----------------------------------------------------------------------------- Here is my makefile ------------------------------------------------------------------------------ #------------------------------------------------------------------------- # rxtx is a native interface to serial ports in java. # Copyright 1997-2002 by Trent Jarvi taj at www.linux.org.uk. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------- # This Makefile works on windows 98/NT with mingw32 in a DOS shell # One catch. We cant figure out how to generate .def files with default # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging # C functions. # mingw build tools are used # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH% # mingw32 version 1.0.1-20010726 # jdk was 1.1.8 # java.sun.com ###################### # user defined variables ###################### # path to the source code (directory with SerialImp.c) Unix style path SRC=../src # and the dos path DOSSRC=..\\\src # path to the jdk directory that has include, bin, lib, ... Unix style path JDKHOME=C:/j2sdk1.4.2 #path to mingw32 MINGHOME=C:\MinGW # path to install RXTXcomm.jar DOS style path COMMINSTALL=C:\j2sdk1.4.2\lib # path to install the shared libraries DOS style path LIBINSTALL=C:\j2sdk1.4.2\bin # path to the mingw32 libraries (directory with libmingw32.a) DOS style path LIBDIR=C:\MinGW\lib ###################### # End of user defined variables ###################### ###################### # Tools ###################### AS=as CC=gcc LD=ld DLLTOOL=dlltool # this looks like a nice tool but I was not able to get symbols in the dll. DLLWRAP=dllwrap CLASSPATH=-classpath .; #C:\jdk1..18\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk1.1.8\lib\classes.zip" JAVAH=javah $(CLASSPATH) JAR=jar JAVAC=javac $(CLASSPATH) ###################### # Tool Flags ###################### CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE) JAVAHFLAGS= -jni -d include LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll # path to the java native interface headers (directory with jni.h) JDKINCLUDE=$(JDKHOME)/include MINGINCLUDE=$(MINGHOME)/include JAVAFILES = $(wildcard $(SRC)/*.java) CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc) TARGETLIBS= rxtxSerial.dll DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o all: $(TARGETLIBS) # rebuild rebuild will force everything to be built. rebuild: rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp include: mkdir include gnu: mkdir gnu mkdir gnu\\\io # yayaya We should have put the files in gnu.io to start with gnutimestamp: $(JAVAFILES) $(CFILES) include gnu xcopy $(DOSSRC)\\*.* gnu\\io\\ echo > gnutimestamp # FIXME make 3.79.1 behaves really strage if we use %.o rules. init.o: $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o fixup.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o SerialImp.o: $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o fuserImp.o: $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o termios.o: $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o # This file is a pain in the rear to generate. If your looking at this you # need to install cygwin. $(SRC)/Serial.def: $(DLLOBJECTS) $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 xcopy $(DOSSRC)\\Serial.def gnu\\io\\ # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def $(TARGETLIBS): RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \ $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \ --base-file Serial.base --output-exp Serial.exp $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \ $(DLLOBJECTS) $(LIBS) -e _dll_entry at 12 # # This should replace the mess above if it worked. # nm shows no symbols in the dll produced. The old stuff above works ok. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \ # --add-stdcall-alias --driver-name gcc -mwindows \ # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s # -mno-cygwin RXTXcomm.jar: gnutimestamp $(JAVAC) gnu\\io\\*.java $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java)) include/config.h: gnutimestamp echo "#define HAVE_FCNTL_H 1" > include\\\config.h echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h echo "#undef HAVE_TERMIOS_H" >> include\\\config.h install: all xcopy RXTXcomm.jar $(COMMINSTALL) xcopy $(TARGETLIBS) $(LIBINSTALL) uninstall: del $(COMMINSTALL)\\\RXTXcomm.jar del $(LIBINSTALL)\\\$(TARGETLIBS) clean: deltree gnu\\\io\\\*.* deltree include del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.* From maxcalipari at vodafone.it Tue Mar 2 02:55:46 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 10:55:46 +0100 Subject: [Rxtx] Please help Message-ID: <40445A22.2030300@vodafone.it> Ok i've tried the binary 2.1.7.pre17 and it works fine. Let's go to next bug in my work......... From maxcalipari at vodafone.it Tue Mar 2 08:06:50 2004 From: maxcalipari at vodafone.it (Massimiliano Calipari) Date: Tue, 02 Mar 2004 16:06:50 +0100 Subject: [Rxtx] Driving rs232-rs485 converter Message-ID: <4044A30A.1050901@vodafone.it> Does anyone know how to drive a rs-232/rs-485 converter from java? What are the excat steps to do? I know that there is a trick with RTS signal, i've tried various solution (even with java CommAPI) but i can't read data